import { FormProps, FormSchema } from '@/components/Table'
import { BasicColumn } from '@/components/Table/src/types/table'
import { pattern } from '@/utils/validate/index'
import { formatBytes } from '@/utils'

// 命名空间列表
export function getNamespaceBasicColumns(): BasicColumn[] {
  return [
    {
      title: '命名空间',
      dataIndex: 'name'
    },
    {
      title: '类型',
      dataIndex: 'type'
    },
    {
      title: '运行状态',
      width: 80,
      dataIndex: 'phase'
    },
    {
      title: '标签',
      width: 480,
      dataIndex: 'labels'
    },
    {
      title: '创建时间',
      dataIndex: 'time'
    },
    {
      title: '操作',
      width: 120,
      dataIndex: 'operate'
    }
  ]
}

export function getSearchFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 80,
    baseColProps: {
      span: 6,
      md: 10,
      xl: 8,
      xxl: 6
    },
    schemas: [
      {
        field: 'name',
        label: '命名空间',
        component: 'Input',
        componentProps: {
          placeholder: '请输入命名空间名称'
        }
      }
    ]
  }
}
